package com.luhuiguo.cms.server.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Basic;
import javax.persistence.Entity;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

import com.google.appengine.api.datastore.Text;

/**
 * 文章
 * 
 * @author LuHuiguo
 * @version $Id: Article.java 163 2010-05-10 15:36:28Z luhuiguo@gmail.com $
 */
@Entity
public class Article implements Serializable {

    private static final long serialVersionUID = -3011990456241035679L;

    /**
     * 标识
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /**
     * 栏目标识
     */
    @Basic
    private Long channelId;

    /**
     * 标题
     */
    @Basic
    private String title;

    /**
     * 主题
     */
    @Basic
    private String subject;

    /**
     * 外部地址
     */
    @Basic
    private String url;

    /**
     * 模板
     */
    @Basic
    private String template;

    /**
     * 作者
     */
    @Basic
    private String author;

    /**
     * 编辑
     */
    @Basic
    private String editor;

    /**
     * 来源
     */
    @Basic
    private String source;

    /**
     * 关键字
     */
    @Basic
    private String keywords;

    /**
     * 描述
     */
    @Basic
    private String description;

    /**
     * 摘要
     */
    @Basic
    private String summary;

    /**
     * 正文
     */
    @Enumerated
    private Text content;

    /**
     * 排序等级
     */
    @Basic
    private int rank;

    /**
     * 推荐等级
     */
    @Basic
    private int grade;

    /**
     * 状态
     */
    @Basic
    private int status;

    /**
     * 允许评论
     */
    @Basic
    private boolean allowComment;

    /**
     * 点击次数
     */
    @Basic
    private int clicks;

    /**
     * 支持数
     */
    @Basic
    private int buzzUp;

    /**
     * 反对数
     */
    @Basic
    private int buzzDown;

    /**
     * 发布日期
     */
    @Basic
    private Date publishDate;

    /**
     * 失效日期
     */
    @Basic
    private Date expiredDate;

    /**
     * 创建时间
     */
    @Basic
    private Date created;

    /**
     * 创建者
     */
    @Basic
    private String createdBy;

    /**
     * 最后修改时间
     */
    @Basic
    private Date lastModified;

    /**
     * 最后修改者
     */
    @Basic
    private String lastModifiedBy;

    public Article() {
    }

    public Article(String title) {

        this.title = title;
    }

    public Article(Long channel, String title, String subject, String author, String source, String keywords,
            String description, String summary, Text content) {
        this.channelId = channel;
        this.title = title;
        this.subject = subject;
        this.author = author;
        this.source = source;
        this.keywords = keywords;
        this.description = description;
        this.summary = summary;
        this.content = content;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getChannelId() {
        return channelId;
    }

    public void setChannelId(Long channelId) {
        this.channelId = channelId;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getSubject() {
        return subject;
    }

    public void setSubject(String subject) {
        this.subject = subject;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getTemplate() {
        return template;
    }

    public void setTemplate(String template) {
        this.template = template;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public String getEditor() {
        return editor;
    }

    public void setEditor(String editor) {
        this.editor = editor;
    }

    public String getSource() {
        return source;
    }

    public void setSource(String source) {
        this.source = source;
    }

    public String getKeywords() {
        return keywords;
    }

    public void setKeywords(String keywords) {
        this.keywords = keywords;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getSummary() {
        return summary;
    }

    public void setSummary(String summary) {
        this.summary = summary;
    }

    public Text getContent() {
        return content;
    }

    public void setContent(Text content) {
        this.content = content;
    }

    public int getRank() {
        return rank;
    }

    public void setRank(int rank) {
        this.rank = rank;
    }

    public int getGrade() {
        return grade;
    }

    public void setGrade(int grade) {
        this.grade = grade;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public boolean isAllowComment() {
        return allowComment;
    }

    public void setAllowComment(boolean allowComment) {
        this.allowComment = allowComment;
    }

    public int getClicks() {
        return clicks;
    }

    public void setClicks(int clicks) {
        this.clicks = clicks;
    }

    public int getBuzzUp() {
        return buzzUp;
    }

    public void setBuzzUp(int buzzUp) {
        this.buzzUp = buzzUp;
    }

    public int getBuzzDown() {
        return buzzDown;
    }

    public void setBuzzDown(int buzzDown) {
        this.buzzDown = buzzDown;
    }

    public Date getPublishDate() {
        return publishDate;
    }

    public void setPublishDate(Date publishDate) {
        this.publishDate = publishDate;
    }

    public Date getExpiredDate() {
        return expiredDate;
    }

    public void setExpiredDate(Date expiredDate) {
        this.expiredDate = expiredDate;
    }

    public Date getCreated() {
        return created;
    }

    public void setCreated(Date created) {
        this.created = created;
    }

    public String getCreatedBy() {
        return createdBy;
    }

    public void setCreatedBy(String createdBy) {
        this.createdBy = createdBy;
    }

    public Date getLastModified() {
        return lastModified;
    }

    public void setLastModified(Date lastModified) {
        this.lastModified = lastModified;
    }

    public String getLastModifiedBy() {
        return lastModifiedBy;
    }

    public void setLastModifiedBy(String lastModifiedBy) {
        this.lastModifiedBy = lastModifiedBy;
    }

    @Override
    public String toString() {
        StringBuilder builder = new StringBuilder();
        builder.append("Article [id=").append(id).append(", channelId=").append(channelId).append(", title=").append(
                title).append("]");
        return builder.toString();
    }

}
